<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/',function(){
   return \Illuminate\Support\Facades\Crypt::encrypt('admin');
});
Route::match(['get','post'],'admin/login','admin\LoginController@Login');
Route::get('admin/code','admin\LoginController@getCode');

Route::group(['prefix'=>'admin','namespace'=>'admin','middleware'=>'App\Http\Middleware\admin_login'],function(){
    Route::get('info','IndexController@Info');
    Route::get('index','IndexController@Index');
    Route::get('logout','LoginController@Logout');
    Route::match(['get','post'],'pass','IndexController@Pass');
    Route::post('cate/changeorder', 'CategoryController@changeOrder');
    //分类路由管理,资源路由有点垃圾啊 尝试很多次失败了
    Route::get('category/list','CategoryController@index');
    Route::get('category/add','CategoryController@add');
    Route::post('category/addhandle','CategoryController@addHandle');
    Route::get('category/edit/{cate_id}','CategoryController@edit');
    Route::post('category/edithandle','CategoryController@editHandle');
    Route::post('category/delcate','CategoryController@delCate');
    //文章路由管理
    Route::resource('article','ArticleController');
    //图片上传
    Route::any('upload','CommonController@upload');
    //再次尝试资源路由 在不成功就去死   哈哈哈 成功了不用死啦
    Route::resource('links','LinksController');
    Route::post('links/changeorder','LinksController@changOrder');
    //导航路由
    Route::resource('navs','NavsController');
    Route::post('navs/changeorder','NavsController@changOrder');
    //网站配置模块路由
    Route::resource('config','ConfigController');

});



